<template>
	<view class="index">
		<view class="message_top">
			<view class="message_top_title" :style="{top:computedTop}">商家中心</view>
			<view class="message_top_back" :style="{top:computedTop}" @click="Back">
				<image src="../../static/search/back.png" class="bfbimages"></image>
			</view>

			<view class="index_info">
				<view>
					<view class="flex">
						<image :src="SJinfo.merchant_avatar" class="bfbimages"></image>
					</view>
					<view>
						<view class="ellipsis">{{SJinfo.merchant_name}}</view>
						<view>
							<view class="flex"
								style="width: 22rpx;height: 24rpx;text-align: center;line-height: 24rpx;margin-right: 10rpx;margin-left: 10rpx;">
								<image :src="SJinfo.icon" class="bfbimages"></image>
							</view>
							<text style="display: inline-block;margin-right: 10rpx;">{{SJinfo.name}}</text>
						</view>
					</view>
				</view>
				<view @click="Cguanzhu">
					<text style="display: inline-block;margin-right: 10rpx;">+</text>
					<text>关注</text>
				</view>
				
				<!-- <view @click="QXCguanzhu">
					<text style="display: inline-block;margin-right: 10rpx;">+</text>
					<text>取消关注</text>
				</view> -->
				
				
			</view>
		</view>

		<view class="index_body_list">
			<view class="index_body_list_two">
				<view class="index_body_list_two_For" v-for="(itemchid, index) in activity" :key="index"
					@click.stop="Chb(itemchid,item)">
					<view class="index_body_list_two_For_one">
						<view>
							<view class="index_body_list_two_For_one_icon flex">

								<image src="../../static/hb_zt/baiq.png" class="bfbimages"
									v-if="itemchid.type==1 && itemchid.status==0"></image>
								<image src="../../static/hb_zt/huiq.png" class="bfbimages"
									v-if="itemchid.type==1 && (itemchid.status==1 || itemchid.status==2)"></image>
								<image src="../../static/hb_zt/hongq.png" class="bfbimages"
									v-if="itemchid.type==1 && itemchid.status==3"></image>

								<image src="../../static/hb_zt/baib.png" class="bfbimages"
									v-if="itemchid.type==2 && itemchid.status==0"></image>
								<image src="../../static/hb_zt/huib.png" class="bfbimages"
									v-if="itemchid.type==2 && (itemchid.status==1 || itemchid.status==2)"></image>
								<image src="../../static/hb_zt/hongb.png" class="bfbimages"
									v-if="itemchid.type==2 && itemchid.status==3"></image>


								<image src="../../static/hb_zt/baiz.png" class="bfbimages"
									v-if="itemchid.type==3 && itemchid.status==0"></image>
								<image src="../../static/hb_zt/huiz.png" class="bfbimages"
									v-if="itemchid.type==3 && (itemchid.status==1 || itemchid.status==2)"></image>
								<image src="../../static/hb_zt/hongz.png" class="bfbimages"
									v-if="itemchid.type==3 && itemchid.status==3"></image>

								<image src="../../static/hb_zt/baic.png" class="bfbimages"
									v-if="itemchid.type==4 && itemchid.status==0"></image>
								<image src="../../static/hb_zt/huic.png" class="bfbimages"
									v-if="itemchid.type==4 && (itemchid.status==1 || itemchid.status==2)"></image>
								<image src="../../static/hb_zt/hongc.png" class="bfbimages"
									v-if="itemchid.type==4&& itemchid.status==3"></image>

							</view>
							<view>
								<!-- 红色背景时 -->
								<text v-if="itemchid.status==0">
									<text v-if="itemchid.type==1">现金红包</text>
									<text v-if="itemchid.type==2">优惠券</text>
									<text v-if="itemchid.type==3">邀约红包</text>
									<text v-if="itemchid.type==4">折扣价</text>
								</text><br />
								<!-- 黄色背景时 -->
								<text style="color: #000000;" v-if="itemchid.status==3">
									<text v-if="itemchid.type==1">现金红包</text>
									<text v-if="itemchid.type==2">优惠券</text>
									<text v-if="itemchid.type==3">邀约红包</text>
									<text v-if="itemchid.type==4">折扣价</text>
								</text><br />
								<text style="color: #FE4926;font-size: 24rpx;" v-if="itemchid.status==3">未使用</text>
								<!-- 灰色背景时 -->
								<text style="color: #666666;" v-if="itemchid.status==1 || itemchid.status==2">
									<text v-if="itemchid.type==1">现金红包</text>
									<text v-if="itemchid.type==2">优惠券</text>
									<text v-if="itemchid.type==3">邀约红包</text>
									<text v-if="itemchid.type==4">折扣价</text>
								</text>
							</view>
						</view>
						<view>
							<view class="zfzq" v-if="itemchid.remaining_nums !== 0 && itemchid.status !== 1" :style="{  
						    color: (itemchid.status == 1 || itemchid.status == 2) ? '#FF3E2F' : (itemchid.status == 3 ? '#413E20' : '#FFED31'),  
						    background: (itemchid.status == 1 || itemchid.status == 2) ? 'rgba(255,63,49,0.2)' : '',  
						    border: (itemchid.status == 1 || itemchid.status == 2) ? '1rpx solid #FF3E2F' : (itemchid.status == 3 ? '1rpx solid #413E20' : '')  
						}">
								转发赚钱
							</view>
							<view class="yjs" v-if="itemchid.status==1">已结束</view>
							<text
								:style="{color:itemchid.status==0?'#FFFFFF':'#666666'}">剩余{{itemchid.remaining_nums}}</text>
						</view>
					</view>
					<image src="../../static/index/hb_red.png" class="bfbimages" v-if="itemchid.status==0"></image>
					<image src="../../static/index/hb_yellow.png" class="bfbimages" v-if="itemchid.status==3">
					</image>
					<image src="../../static/index/hb_gray.png" class="bfbimages"
						v-if="itemchid.status==1 || itemchid.status==2"></image>
				</view>
			</view>
		</view>

		<view class="index_images">
			<u-swiper :list="SJinfo.merchant_banner" indicator indicatorMode="line" circular :height='200'></u-swiper>
		</view>

		<view class="index_map">
			<view>
				<view class="flex"
					style="width: 31rpx;height: 35rpx;text-align: center;line-height: 35rpx;margin-right: 15rpx;">
					<image src="../../static/dinwei.png" class="bfbimages"></image>
				</view>
				<view class="ellipsis textmap">{{SJinfo.address}}{{SJinfo.address_detail}}</view>
			</view>
			<view @click="DaoHnag">
				<view class="flex"
					style="width: 20rpx;height: 20rpx;text-align: center;line-height: 20rpx;margin-right: 10rpx;">
					<image src="../../static/dh.png" class="bfbimages"></image>
				</view>
				<text>导航</text>
			</view>
		</view>

		<view class="index_tab">
			<view v-for="(item,index) in Tab" :key="index"
				:style="{background:item.isA?'linear-gradient( 270deg, #FE4624 0%, #FF8143 100%);':'',color:item.isA?'#FFFFFF':''}"
				@click="Ctab1(item)">{{item.name}}</view>
		</view>

		<view class="index_for_list">
			<text v-if="Tab[0].isA" style="font-size: 26rpx;color: #666666;">{{SJinfo.desc}}</text>

			<view class="index_for_list_nr" v-if="Tab[1].isA" v-for="(item,index) in PL_List" :key="index">
				<view class="index_for_list_nr_L flex">
					<image :src="item.avatar" class="bfbimages"></image>
				</view>
				<view class="index_for_list_nr_R">
					<view class="index_for_list_nr_R_one">
						<text>{{item.nickname}}</text>
						<view style="display: flex;align-items: center;justify-content: flex-end;">
							<u-rate :count="count" v-model="item.credit_nums" :size='14'></u-rate>
							<text>{{item.credit_nums}}</text>
						</view>
					</view>

					<view class="index_for_list_nr_R_two">{{item.content}}</view>
					<view class="index_for_list_nr_R_therr">
						<view class="flex" v-for="(images,index) in item.images" :key="index">
							<image :src="images" class="bfbimages"></image>
						</view>
					</view>
					<view class="index_for_list_nr_R_date">{{item.create_time}}</view>
					
				</view>
			</view>

		</view>
		<view style="width: 100%;height: 150rpx;"></view>
		<view class="index_btn flex">
			<view class="flex"
				style="width: 24rpx;height: 20rpx;text-align: center;line-height: 20rpx;margin-right: 20rpx;">
				<image src="../../static/xx.png" class="bfbimages"></image>
			</view>
			<text>联系商家</text>
		</view>
		
		
		<!-- 红包弹出 -->
		<view class="HongBao" v-if="HongBaoshow">
			<!-- 1=文字 2=图片 3=视频 -->
			<view class="HongBao_one" v-if="OneDataShow.ad_type==2">
				<u-swiper :list="list1" :height="220" :radius="0"></u-swiper>
			</view>
			<view class="HongBao_one" v-if="OneDataShow.ad_type==3">
				<u-swiper :list="list4" keyName="url" :autoplay="false" :height="220" :radius="0"></u-swiper>
			</view>
			<view class="HongBao_one" v-if="OneDataShow.ad_type==1">
				<view class="HongBao_one_text">{{OneDataShow.ad_content}}</view>
			</view>
		
			<!-- 	RedOne:'',//现金
			RedTwo:'',//优惠券红包
			RedTherr:'',//邀约红包
			RedFour:''//折扣价红包 -->
		
			<!-- 现金红包 -->
			<view class="HongBao_x">
				<view class="HongBao_x_tab">
					<view v-for="(item,index) in vForTab" :key="index"
						:class="item.isA?'HongBao_x_tab_for1':'HongBao_x_tab_for'" @click="Ctab(item)">{{item.name}}
					</view>
				</view>
		
				<view class="HongBao_x_text">{{GG.describe_title}}</view>
				<view class="HongBao_x_hb flex">
					<view class="HongBao_x_hb_no flex" @click="HbOut">
						<image src="../../static/cha.png" class="bfbimages"></image>
					</view>
		
					<!-- 现金1 -->
					<view class="HongBao_x_hb_src flex" v-if="Hnum==1">
						<image src="../../static/hb_bj1.png" class="bfbimages"></image>
						<view class="HongBao_x_hb_src_title">{{RedOne.name}}</view>
						<view class="HongBao_x_hb_src_text">现金红包</view>
						<view class="HongBao_x_hb_src_num">还有{{RedOne.remaining_nums}}份红包可领取</view>
						<view class="HongBao_x_hb_src_kai" @click="cjk"></view>
					</view>
		
					<!-- 现金2 -->
					<view class="HongBao_x_hb_src flex" v-if="Hnum==2">
						<image src="../../static/hb_bj.png" class="bfbimages"></image>
						<view class="HongBao_x_hb_src_title" style="color: #EB3127;">现金红包</view>
						<view class="HongBao_x_hb_src_price">
							<text>￥</text>
							<text style="font-size: 113rpx;font-weight: bold;">{{LquPrice1}}</text>
						</view>
						<view class="HongBao_x_hb_src_btn" @click="Hnum=3">立即领取</view>
						<view class="HongBao_x_hb_src_num">还有{{RedOne.remaining_nums}}份红包可领取</view>
					</view>
		
					<!-- 现金3 -->
					<view class="HongBao_x_hb_src flex" v-if="Hnum==3">
						<image src="../../static/hb_bj.png" class="bfbimages"></image>
						<view class="HongBao_x_hb_src_title"
							style="color: #EB3127;display: flex;align-items: center;justify-content: center;">
							<view class="flex"
								style="width: 28rpx;height: 28rpx;text-align: center;line-height: 28rpx;margin-right: 10rpx;">
								<image src="../../static/red_success.png" class="bfbimages"></image>
							</view>
							<text style="font-size: 32rpx;color: #EB3127;font-weight: bold;">领取成功</text>
						</view>
						<view class="HongBao_x_hb_src_mn">{{LquPrice1}}元已到账</view>
						<view class="HongBao_x_hb_src_me" @click="LinkQianBao">
							<text>我的钱包</text>
							<view class="flex"
								style="width: 18rpx;height: 22rpx;text-align: center;line-height: 22rpx;margin-left: 10rpx;">
								<image src="../../static/red_right.png" class="bfbimages"></image>
							</view>
						</view>
						<view class="HongBao_x_hb_src_btn"
							style="background-color: transparent;border: 2rpx dashed #FFF3E4;color: #FFF3E4;">立即转发
						</view>
						<view class="HongBao_x_hb_src_ts">赚取更多佣金</view>
					</view>
		
					<!-- 优惠卷1 -->
					<view class="HongBao_y_hb_src" v-if="Hnum==4">
						<image src="../../static/yb_bj.png" class="bfbimages"></image>
						<view class="HongBao_y_hb_src_title">{{RedTwo.name}}</view>
						<view class="HongBao_y_hb_src_yb_box">
							<view>
								<text>￥</text>
								<text
									style="font-size: 60rpx;font-weight: bold;color: #EB3127;">{{RedTwo.amount==null?'0.00':`${RedTwo.amount}`}}</text>
							</view>
							<view>
								<text>优惠券</text><br />
								<text
									style="font-size: 26rpx;color: #897F73;font-weight: 500;">剩余{{RedTwo.expire_day}}天到期</text>
							</view>
							<view>
								<view style="width: 160rpx;height: 52rpx;background: linear-gradient( 90deg, #FCDFAF 0%, #FEEEDD 52%, #FDE9C2 100%);
								border-radius: 70rpx;border: 1rpx solid #FFF3E4;font-family: PingFang SC, PingFang SC;font-weight: 800;font-size: 28rpx;
								color: #E71708;text-align: center;line-height: 52rpx;" @click="yhqk">立即领取</view>
								<text style="font-size: 24rpx;color: #FEC468;">剩余：{{RedTwo.remaining_nums}}</text>
							</view>
						</view>
					</view>
					<!-- 优惠卷2 -->
					<view class="HongBao_x_hb_src flex" v-if="Hnum==5">
						<image src="../../static/hb_bj.png" class="bfbimages"></image>
						<view class="HongBao_x_hb_src_title"
							style="color: #EB3127;display: flex;align-items: center;justify-content: center;">
							<view class="flex"
								style="width: 28rpx;height: 28rpx;text-align: center;line-height: 28rpx;margin-right: 10rpx;">
								<image src="../../static/red_success.png" class="bfbimages"></image>
							</view>
							<text style="font-size: 32rpx;color: #EB3127;font-weight: bold;">领取成功</text>
						</view>
						<view class="HongBao_x_hb_src_mn">{{RedTwo.amount}}元已到账</view>
						<view class="HongBao_x_hb_src_me" @click="LinkChakan">
							<text>查看二维码</text>
							<view class="flex"
								style="width: 18rpx;height: 22rpx;text-align: center;line-height: 22rpx;margin-left: 10rpx;">
								<image src="../../static/red_right.png" class="bfbimages"></image>
							</view>
						</view>
						<view class="HongBao_x_hb_src_btn"
							style="background-color: transparent;border: 2rpx dashed #FFF3E4;color: #FFF3E4;"
							@click="Hnum=6">立即核销</view>
						<view class="HongBao_x_hb_src_ts">赚取更多佣金</view>
					</view>
					<!-- 优惠卷3 -->
					<view class="HongBao_hx_hb_src" v-if="Hnum==6">
						<view>优惠券核销码</view>
						<view class="flex" @click="LinkHX">
							<image src="../../static/logo.png" class="bfbimages"></image>
						</view>
						<view>请出示给工作人员扫码核销</view>
					</view>
		
					<!-- 折扣价1 -->
					<view class="HongBao_y_hb_src" v-if="Hnum==7">
						<image src="../../static/yb_bj.png" class="bfbimages"></image>
						<view class="HongBao_y_hb_src_title">{{RedFour.name}}</view>
						<view class="HongBao_y_hb_src_yb_box">
							<view>
								<text>￥</text>
								<text
									style="font-size: 60rpx;font-weight: bold;color: #EB3127;">{{RedFour.amount==null?'0.00':`${RedFour.amount}`}}</text>
							</view>
							<view>
								<text>折扣价</text><br />
								<text
									style="font-size: 26rpx;color: #897F73;font-weight: 500;">剩余{{RedFour.expire_day}}天到期</text>
							</view>
							<view>
								<view style="width: 160rpx;height: 52rpx;background: linear-gradient( 90deg, #FCDFAF 0%, #FEEEDD 52%, #FDE9C2 100%);
								border-radius: 70rpx;border: 1rpx solid #FFF3E4;font-family: PingFang SC, PingFang SC;font-weight: 800;font-size: 28rpx;
								color: #E71708;text-align: center;line-height: 52rpx;" @click="zkk">立即领取</view>
								<text style="font-size: 24rpx;color: #FEC468;">剩余：{{RedFour.remaining_nums}}</text>
							</view>
						</view>
					</view>
					<!-- 折扣价2 -->
					<view class="HongBao_x_hb_src flex" v-if="Hnum==8">
						<image src="../../static/hb_bj.png" class="bfbimages"></image>
						<view class="HongBao_x_hb_src_title"
							style="color: #EB3127;display: flex;align-items: center;justify-content: center;">
							<view class="flex"
								style="width: 28rpx;height: 28rpx;text-align: center;line-height: 28rpx;margin-right: 10rpx;">
								<image src="../../static/red_success.png" class="bfbimages"></image>
							</view>
							<text style="font-size: 32rpx;color: #EB3127;font-weight: bold;">领取成功</text>
						</view>
						<view class="HongBao_x_hb_src_mn">{{RedFour.amount}}元已到账</view>
						<view class="HongBao_x_hb_src_me" @click="LinkChakan">
							<text>查看二维码</text>
							<view class="flex"
								style="width: 18rpx;height: 22rpx;text-align: center;line-height: 22rpx;margin-left: 10rpx;">
								<image src="../../static/red_right.png" class="bfbimages"></image>
							</view>
						</view>
						<view class="HongBao_x_hb_src_btn"
							style="background-color: transparent;border: 2rpx dashed #FFF3E4;color: #FFF3E4;"
							@click="Hnum=6">立即核销</view>
						<view class="HongBao_x_hb_src_ts">赚取更多佣金</view>
					</view>
					<!-- 折扣价3 -->
					<view class="HongBao_hx_hb_src" v-if="Hnum==9">
						<view>优惠券核销码</view>
						<view class="flex" @click="LinkHX">
							<image src="../../static/logo.png" class="bfbimages"></image>
						</view>
						<view>请出示给工作人员扫码核销</view>
					</view>
		
		
					<!-- 邀约1 -->
					<view class="HongBao_x_hb_src flex" v-if="Hnum==10">
						<image src="../../static/hb_bj1.png" class="bfbimages"></image>
						<view class="HongBao_x_hb_src_title">{{RedTherr.name}}</view>
						<view class="HongBao_x_hb_src_text">邀约红包</view>
						<view class="HongBao_x_hb_src_num">还有{{RedTherr.remaining_nums}}份红包可领取</view>
						<view class="HongBao_x_hb_src_kai" @click="yyk"></view>
					</view>
		
					<!-- 邀约2 -->
					<view class="HongBao_x_hb_src flex" v-if="Hnum==11">
						<image src="../../static/hb_bj.png" class="bfbimages"></image>
						<view class="HongBao_x_hb_src_title" style="color: #EB3127;">邀约红包</view>
						<view class="HongBao_x_hb_src_price">
							<text>￥</text>
							<text style="font-size: 113rpx;font-weight: bold;">{{RedTherr.amount}}</text>
						</view>
						<view class="HongBao_x_hb_src_btn" @click="Hnum=3">立即领取</view>
						<view class="HongBao_x_hb_src_num">还有{{RedTherr.remaining_nums}}份红包可领取</view>
					</view>
		
					<!-- 邀约3 -->
					<view class="HongBao_x_hb_src flex" v-if="Hnum==12">
						<image src="../../static/hb_bj.png" class="bfbimages"></image>
						<view class="HongBao_x_hb_src_title"
							style="color: #EB3127;display: flex;align-items: center;justify-content: center;">
							<view class="flex"
								style="width: 28rpx;height: 28rpx;text-align: center;line-height: 28rpx;margin-right: 10rpx;">
								<image src="../../static/red_success.png" class="bfbimages"></image>
							</view>
							<text style="font-size: 32rpx;color: #EB3127;font-weight: bold;">领取成功</text>
						</view>
						<view class="HongBao_x_hb_src_mn">{{RedTherr.amount}}元已到账</view>
					<view class="HongBao_x_hb_src_me" @click="LinkChakan">
						<text>查看二维码</text>
						<view class="flex"
							style="width: 18rpx;height: 22rpx;text-align: center;line-height: 22rpx;margin-left: 10rpx;">
							<image src="../../static/red_right.png" class="bfbimages"></image>
						</view>
					</view>
						<view class="HongBao_x_hb_src_btn"
							style="background-color: transparent;border: 2rpx dashed #FFF3E4;color: #FFF3E4;">立即转发
						</view>
						<view class="HongBao_x_hb_src_ts">赚取更多佣金</view>
					</view>
		
				</view>
				<view class="HongBao_x_gs" v-html="GG.notes_collection"></view>
			</view>
		
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuButtonInfo: null,
				Tab: [{
						name: '店铺简介',
						isA: true
					},
					{
						name: '评价记录',
						isA: false
					}
				],
				count: 5,
				value: 5,
				member_id: '',
				SJinfo: '',
				lat: 34.751345,
				lng: 113.665146,
				activity: '',
				RedOne: '', //现金
				RedTwo: '', //优惠券红包
				RedTherr: '', //邀约红包
				RedFour: '', //折扣价红包
				GG: '',
				OneDataShow: '',
				LquPrice1: '',
				Hnum: 1, //1-3现金红包
				HongBaoshow: false,
				list1: [],
				list4: [],
				vForTab: [{ // 1=红包,2=优惠券,3=邀约,4=折扣价
						name: '现金红包',
						isA: true,
						type: 1
					},
					{
						name: '优惠券',
						isA: false,
						type: 2
					},
					{
						name: '折扣价',
						isA: false,
						type: 4
					},
					{
						name: '邀约红包',
						isA: false,
						type: 3
					}
				],
				PL_List:'',//评论列表
			}
		},
		computed: {
			computedTop() {
				if (this.menuButtonInfo) {
					return `${this.menuButtonInfo.height * 2 - 6}px`;
				}
				return '0px';
			},
		},
		onLoad(options) {
			const info = uni.getMenuButtonBoundingClientRect();
			this.menuButtonInfo = info;
			this.member_id = options.member_id
			this.ShangJiaInfo()
		},
		onShow() {
			this.GGapiE()
		},
		methods: {
			Cguanzhu(){
				let darta={
					merchant_id:this.SJinfo.id
				}
				this.$request('/api/user/toFollow',darta).then((res)=>{
					console.log(res,'关注');
					if(res.code==1){
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 1500
						});
						this.ShangJiaInfo()
					}else{
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 1500
						});
						return
					}
				})
			},
			QXCguanzhu(){
				let darta={
					merchant_id:this.SJinfo.id
				}
				this.$request('/api/user/cancelFollow',darta).then((res)=>{
					console.log(res,'取消关注');
					if(res.code==1){
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 1500
						});
						this.ShangJiaInfo()
					}else{
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 1500
						});
						return
					}
				})
			},
			LinkQianBao(){
				uni.navigateTo({
					url:'/pages/wallet/wallet'
				})
			},
			LinkChakan(){
				uni.navigateTo({
					url:'/pages/RedEnvelope/RedEnvelope'
				})
			},
			GGapiE() {
				this.$request('/api/common/getConfig').then((res) => {
					console.log(res, '公共配置');
					this.GG = res.data
				})
			},
			yyk() {
				this.HongReceiveApi(this.RedTherr.id, 4)
			},
			zkk() {
				this.HongReceiveApi(this.RedFour.id, 3)
			},
			yhqk() {
				this.HongReceiveApi(this.RedTwo.id, 2)
			},
			cjk() {
				this.HongReceiveApi(this.RedOne.id, 1)
			},
			HongReceiveApi(activity_id, type) {
				let data = {
					activity_id: activity_id
				}
				this.$request('/api/receive/receiveActivity', data).then((res) => {
					console.log(res, '领取红包');
					this.LquPrice1 = res.data
					console.log(this.LquPrice1, 'this.LquPrice1');
					if (res.code !== 1) {
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 1500
						});
						return
					} else {
						if (type == 1) {
							this.Hnum = 2
						} else if (type == 2) {
							this.Hnum = 5
						} else if (type == 3) {
							this.Hnum = 8
						} else if (type == 4) {
							this.Hnum = 11
						}
					}
				})
			},
			Chb(itemchid, item) {

				console.log('点击的子级', itemchid);

				if (itemchid.status == 1) {
					uni.showToast({
						title: '该活动已结束',
						icon: 'none',
						duration: 1500
					});
					return
				}


				for (var i = 0; i < this.vForTab.length; i++) {
					this.vForTab[i].isA = false
				}
				
				// 类型1=红包 2=优惠券 3=邀约 4=折扣
				if (itemchid.type == 1) {
					this.vForTab[0].isA = true
					this.Hnum = 1
				} else if (itemchid.type == 2) {
					this.vForTab[1].isA = true
					this.Hnum = 4
				} else if (itemchid.type == 3) {
					this.vForTab[3].isA = true
					this.Hnum = 10
				} else if (itemchid.type == 4) {
					this.vForTab[2].isA = true
					this.Hnum = 7
				}


				this.HuoDongXQApi()
				this.HongBaoshow = true
			},
			HuoDongXQApi() {
				let dara = {
					longitude: this.lng,
					latitude: this.lat,
					merchant_id: this.SJinfo.id
				}
				this.$request('/api/merchant/userActivity', dara).then((res) => {
					console.log(res, '详情');

					let existingTypes = res.data.map(item => item.type);
					// 过滤 vForTab，移除不存在于 res.data 中的 type  
					this.vForTab = this.vForTab.filter(item => existingTypes.includes(item.type));
					
					// 处理现金
					for (var i = 0; i < res.data.length; i++) {
						if (res.data[i].type == 1) {
							console.log('现金红包:', res.data[i]);
							this.RedOne = res.data[i]
						}
						if (res.data[i].type == 2) {
							console.log('优惠券红包:', res.data[i]);
							this.RedTwo = res.data[i]
						}
						if (res.data[i].type == 3) {
							console.log('邀约红包:', res.data[i]);
							this.RedTherr = res.data[i]
						}
						if (res.data[i].type == 4) {
							console.log('折扣价红包:', res.data[i]);
							this.RedFour = res.data[i]
						}
					}

					// 类型1=红包 2=优惠券 3=邀约 4=折扣
					this.OneDataShow = ''
					setTimeout(() => {
						if (this.Hnum = 1) {
							this.OneDataShow = this.RedOne
						} else if (this.Hnum = 4) {
							this.OneDataShow = this.RedTwo
						} else if (this.Hnum = 10) {
							this.OneDataShow = this.RedFour
						} else if (this.Hnum = 7) {
							this.OneDataShow = this.RedTherr
						}

						console.log(this.OneDataShow, '顶部显示数据')

						for (var i = 0; i < this.OneDataShow.ad_content.length; i++) {
							this.list1 = ''
							if (this.OneDataShow == 2) { //图片
								this.list1.push(this.OneDataShow.ad_content[i].url)
							} else { //视频
								let Exs = {
									url: this.OneDataShow.ad_content[i].url
								}
								this.list4.push(Exs)
							}
						}

					}, 150)

					this.$forceUpdate()
				})
			},
			HbOut() {
				this.HongBaoshow = false
				this.Hnum = 1
			},
			ShangJiaInfo() {
				let data = {
					merchant_member_id: this.member_id,
				}
				this.$request('/api/merchant/merchantInfo', data).then((res) => {
					console.log(res.data, '商家信息');
					this.SJinfo = res.data
					this.HBlistApi()
				})
			},
			HBlistApi() {
				let data = {
					merchant_id: this.SJinfo.id,
					longitude: this.lng,
					latitude: this.lat,
				}
				this.$request('/api/merchant/userActivity', data).then((res) => {
					console.log(res, '详情');
					this.activity = res.data
				})
			},
			Huoqu_Map() {
				let _this = this
				console.log('外层1');
				uni.getLocation({
					type: "wgs84",
					success(res) {
						console.log('内层1');

						_this.lat = Number(res.latitude),
							_this.lng = Number(res.longitude)

						// _this.ListApi()
					}

				});
			},
			Ctab1(item) {
				for (var i = 0; i < this.Tab.length; i++) {
					this.Tab[i].isA = false
				}
				item.isA = true
				
				if(item.name=='评价记录'){
					this.PjiaApi()
				}
				
			},
			PjiaApi(){
				let data={
					merchant_member_id: this.member_id,
				}
				this.$request('/api/merchant/evaluateList',data).then((res)=>{
					console.log(res.data.data,'商家评论列表');
					this.PL_List=res.data.data
				})
			},
			Ctab(item) {
				for (var i = 0; i < this.vForTab.length; i++) {
					this.vForTab[i].isA = false
				}
				item.isA = true
			
				if (item.name == '现金红包') {
					this.Hnum = 1
				} else if (item.name == '优惠券') {
					this.Hnum = 4
				} else if (item.name == '折扣价') {
					this.Hnum = 7
				} else if (item.name == '邀约红包') {
					this.Hnum = 10
				}
			},
			DaoHnag() {
				uni.openLocation({
					latitude: Number(this.ShangJiaInf.latitude), // 目标位置的纬度
					longitude: Number(this.ShangJiaInf.longitude), // 目标位置的经度
					name: this.ShangJiaInf.address, // 目标位置的名称
					address: this.ShangJiaInf.addressaddress_detail, // 目标位置的地址
					scale: 18 // 地图缩放级别，范围1-28
				});
			},
			Back() {
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss">
	.index {
		width: 100vw;
		min-height: 100vh;
		float: left;


		.message_top {
			width: 100%;
			height: 350rpx;
			position: relative;
			background: linear-gradient(180deg, #FBEADA 0%, #FFFFFF 100%);

			.message_top_title {
				width: 100%;
				text-align: center;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 36rpx;
				color: #333333;
				position: absolute;
				left: 0;
				z-index: 2;
			}

			.message_top_back {
				width: 44rpx;
				height: 44rpx;
				position: absolute;
				left: 30rpx;
				z-index: 9;
			}

			.index_info {
				width: 690rpx;
				height: 140rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				position: absolute;
				left: 50%;
				top: 210rpx;
				transform: translate(-50%, 0);
				z-index: 9;
			}

			.index_info>view:nth-child(1) {
				width: 85%;
				height: 100%;
				display: flex;
				align-items: center;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 36rpx;
				color: #333333;
			}

			.index_info>view:nth-child(1)>view:nth-child(1) {
				width: 140rpx;
				height: 140rpx;
				border-radius: 50%;
				overflow: hidden;
				margin-right: 20rpx;
			}

			.index_info>view:nth-child(1)>view:nth-child(2) {
				width: 400rpx;
				height: 140rpx;

			}

			.index_info>view:nth-child(1)>view:nth-child(2)>view:nth-child(1) {
				width: 100%;
				height: 50%;
				line-height: 70rpx;
			}

			.index_info>view:nth-child(1)>view:nth-child(2)>view:nth-child(2) {
				width: 140rpx;
				height: 44rpx;
				background: #FFEBE2;
				border-radius: 10rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #FF6421;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: 10rpx;
			}

			.index_info>view:nth-child(2) {
				width: 128rpx;
				height: 48rpx;
				background: linear-gradient(270deg, #FE4624 0%, #FF8143 100%);
				border-radius: 40rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 28rpx;
				color: #FFFFFF;
				display: flex;
				align-items: center;
				justify-content: center;

			}
		}

		.index_body_list {
			width: 690rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 3rpx 25rpx 0rpx rgba(88, 64, 64, 0.09);
			border-radius: 20rpx;
			margin: 0 auto 0;
			padding: 20rpx 20rpx;

			.index_body_list_two {
				width: 97%;
				height: auto;
				display: flex;
				align-items: center;
				justify-content: space-between;
				flex-wrap: wrap;
				margin: 0 auto 0;

				.index_body_list_two_For {
					width: 325rpx;
					height: 90rpx;
					border-radius: 10rpx;
					overflow: hidden;
					margin-bottom: 6rpx;
					margin-top: 6rpx;
					position: relative;

					.index_body_list_two_For_one {
						width: 90%;
						display: flex;
						align-items: center;
						justify-content: space-between;
						position: absolute;
						left: 50%;
						top: 50%;
						transform: translate(-50%, -50%);
						color: #FFFFFF;
						font-family: PingFang SC, PingFang SC;
						font-weight: bold;
						font-size: 32rpx;
						color: #FFFFFF;
					}

					.index_body_list_two_For_one>view:nth-child(1) {
						width: 60%;
						height: 100%;
						display: flex;
						align-items: center;
					}

					.index_body_list_two_For_one>view:nth-child(2) {
						width: 40%;
						height: 100%;
						display: flex;
						align-items: center;
						justify-content: flex-end;
						flex-wrap: wrap;
						text-align: right;
						font-weight: 500;
						font-size: 24rpx;
					}

					.zfzq {
						width: 96rpx;
						height: 24rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #FFED31;
						line-height: 24rpx;
						text-align: left;
						font-style: normal;
						text-transform: none;
						border-radius: 4rpx;
						border: 1rpx solid #FFED31;
					}

					.yjs {
						width: 80rpx;
						height: 32rpx;
						background: rgba(102, 102, 102, 0.2);
						border-radius: 4rpx 4rpx 4rpx 4rpx;
						border: 1rpx solid #666666;
						display: flex;
						align-items: center;
						justify-content: center;
						width: 72rpx;
						height: 24rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
						line-height: 24rpx;
						text-align: left;
						font-style: normal;
						text-transform: none;
					}

					.index_body_list_two_For_one_icon {
						width: 27rpx;
						height: 27rpx;
						// background-color: green;
						overflow: hidden;
						margin-right: 10rpx;
					}
				}
			}
		}

		.index_images {
			width: 690rpx;
			height: 400rpx;
			border-radius: 10rpx;
			margin: 20rpx auto 0;
			overflow: hidden;
		}

		.index_map {
			width: 640rpx;
			height: 88rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 3rpx 25rpx 0rpx rgba(88, 64, 64, 0.09);
			border-radius: 20rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #333333;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding-left: 25rpx;
			padding-right: 25rpx;
			margin: 20rpx auto 0;
		}

		.index_map>view:nth-child(1),
		.index_map>view:nth-child(2) {
			width: 70%;
			height: 100%;
			display: flex;
			align-items: center;
		}

		.index_map>view:nth-child(2) {
			width: 30%;
			justify-content: flex-end;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 28rpx;
			color: #F95518;
		}

		.textmap {
			width: 380rpx;
		}

		.index_tab {
			width: 100%;
			height: 50rpx;
			margin: 48rpx auto 0;
			display: flex;
			align-items: center;
			justify-content: center;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #FFFFFF;
		}

		.index_tab>view {
			width: 172rpx;
			height: 48rpx;
			background: #F2F2F2;
			border-radius: 30rpx;
			text-align: center;
			line-height: 48rpx;
			color: #333333;
		}

		.index_tab>view:nth-child(2) {
			margin-left: 30rpx;
		}

		.index_for_list {
			width: 690rpx;
			margin: 20rpx auto 0;

			.index_for_list_nr {
				width: 100%;
				height: auto;
				display: flex;
				align-items: flex-start;
				justify-content: space-between;
				margin-bottom: 10rpx;

				.index_for_list_nr_L {
					width: 60rpx;
					height: 60rpx;
					margin-right: 20rpx;
					border-radius: 50%;
					overflow: hidden;
					text-align: center;
					line-height: 60rpx;
				}

				.index_for_list_nr_R {
					width: 610rpx;
					min-height: 60rpx;

					.index_for_list_nr_R_one {
						width: 100%;
						height: 24rpx;
						display: flex;
						align-items: center;
						justify-content: space-between;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
						margin-top: 5rpx;

					}

					.index_for_list_nr_R_two {
						width: 100%;
						height: auto;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 28rpx;
						color: #333333;
						margin-top: 15rpx;
						margin-bottom: 6rpx;
					}

					.index_for_list_nr_R_therr {
						width: 100%;
						height: auto;
						display: flex;
						align-items: center;
						flex-wrap: wrap;
						margin-top: 6rpx;
					}

					.index_for_list_nr_R_therr>view {
						width: 180rpx;
						height: 180rpx;
						margin-right: 15rpx;
						margin-bottom: 15rpx;
						overflow: hidden;
					}
					.index_for_list_nr_R_date{
						width: 100%;
						height: 50rpx;
						text-align: right;
						line-height: 50rpx;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
						margin-top: 5rpx;
					}
				}
			}
		}

		.index_btn {
			width: 690rpx;
			height: 72rpx;
			background: linear-gradient(270deg, #FE4624 0%, #FF8143 100%);
			border-radius: 40rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 72rpx;
			position: fixed;
			left: 50%;
			bottom: 25rpx;
			transform: translate(-50%, 0);
			z-index: 9;
		}
	}
	
	.HongBao {
		width: 100vw;
		height: 100vh;
		background-color: rgba(0, 0, 0, 0.7);
		position: fixed;
		left: 0;
		top: 0;
		right: 0;
		bottom: 0;
		z-index: 99999;
	
		.HongBao_one {
			width: 100%;
			height: 440rpx;
			background: linear-gradient(180deg, #FF2251 0%, #FF4E4E 100%);
			overflow: hidden;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 28rpx;
			color: #FFFFFF;
			position: relative;
	
			.HongBao_one_text {
				width: 90%;
				min-height: 5%;
				max-height: 85%;
				position: absolute;
				left: 50%;
				bottom: 0;
				transform: translate(-50%, -60%);
				z-index: 9;
				overflow-y: scroll;
			}
		}
	
		.HongBao_x {
			width: 100%;
			height: calc(100vh - 440rpx);
			// background-color: violet;
	
			.HongBao_x_tab {
				width: 100%;
				height: 156rpx;
				display: flex;
				align-items: center;
				justify-content: space-around;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #333333;
			}
	
			.HongBao_x_tab_for,
			.HongBao_x_tab_for1 {
				width: 150rpx;
				height: 68rpx;
				background: #F2F2F2;
				border-radius: 50rpx;
				text-align: center;
				line-height: 68rpx;
			}
	
			.HongBao_x_tab_for1 {
				background: linear-gradient(270deg, #FE4624 0%, #FF8143 100%);
				color: #F2F2F2;
			}
	
			.HongBao_x_text {
				width: 100%;
				height: auto;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #FEC468;
				text-align: center;
			}
	
			.HongBao_x_hb {
				width: 97%;
				height: 620rpx;
				margin: 20rpx auto 0;
				// background-color: greenyellow;
				position: relative;
	
				.HongBao_x_hb_no {
					width: 55rpx;
					height: 55rpx;
					text-align: center;
					line-height: 55rpx;
					position: absolute;
					right: 0;
					top: 0;
					z-index: 9;
				}
	
				.HongBao_x_hb_src {
					width: 420rpx;
					height: 564rpx;
					position: relative;
	
					.HongBao_x_hb_src_title,
					.HongBao_x_hb_src_text,
					.HongBao_x_hb_src_num {
						width: 100%;
						position: absolute;
						left: 0;
						top: 80rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 28rpx;
						color: #FFFFFF;
						z-index: 9;
						text-align: center;
					}
	
					.HongBao_x_hb_src_text {
						font-weight: bold;
						font-size: 44rpx;
						color: #FEC468;
						top: 140rpx;
					}
	
					.HongBao_x_hb_src_num {
						font-size: 24rpx;
						color: #FEC468;
						top: 490rpx;
					}
	
					.HongBao_x_hb_src_kai {
						width: 180rpx;
						height: 180rpx;
						position: absolute;
						left: 50%;
						top: 65%;
						transform: translate(-50%, -50%);
						z-index: 9;
						// background-color: blue;
					}
	
					.HongBao_x_hb_src_price {
						width: 100%;
						height: auto;
						display: flex;
						align-items: center;
						justify-content: center;
						font-family: DIN 30640 Std, DIN 30640 Std;
						font-weight: normal;
						font-size: 32rpx;
						color: #EB3127;
						position: absolute;
						left: 0;
						top: 140rpx;
						z-index: 9;
					}
	
					.HongBao_x_hb_src_btn {
						width: 328rpx;
						height: 67rpx;
						border-radius: 34rpx;
						text-align: center;
						line-height: 67rpx;
						background-color: #FEEEDD;
						font-family: PingFang SC, PingFang SC;
						font-weight: 800;
						font-size: 38rpx;
						color: #E71708;
						position: absolute;
						left: 50%;
						top: 390rpx;
						transform: translate(-50%, 0);
						z-index: 9;
					}
	
					.HongBao_x_hb_src_mn {
						width: 100%;
						position: absolute;
						top: 140rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #EB3127;
						text-align: center;
					}
	
					.HongBao_x_hb_src_me {
						width: 100%;
						height: 30rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						position: absolute;
						left: 0;
						top: 240rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: bold;
						font-size: 26rpx;
						color: #EB3127;
					}
	
					.HongBao_x_hb_src_ts {
						width: 100%;
						position: absolute;
						left: 0;
						top: 480rpx;
						z-index: 9;
						font-family: PingFang SC, PingFang SC;
						font-weight: bold;
						font-size: 24rpx;
						color: #FFF3E4;
						text-align: center;
					}
				}
	
				.HongBao_y_hb_src {
					width: 670rpx;
					height: 238rpx;
					position: relative;
	
					.HongBao_y_hb_src_title {
						width: 100%;
						text-align: center;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 28rpx;
						color: #FFFFFF;
						position: absolute;
						left: 0;
						top: -150rpx;
						z-index: 8;
					}
	
					.HongBao_y_hb_src_yb_box {
						width: 100%;
						height: 100%;
						display: flex;
						align-items: center;
						position: absolute;
						left: 0;
						right: 0;
						top: 0;
						bottom: 0;
					}
	
					.HongBao_y_hb_src_yb_box>view:nth-child(1) {
						width: 213rpx;
						height: auto;
						display: flex;
						align-items: center;
						font-family: DIN 30640 Std, DIN 30640 Std;
						font-weight: normal;
						font-size: 40rpx;
						color: #EB3127;
						margin-left: 20rpx;
					}
	
					.HongBao_y_hb_src_yb_box>view:nth-child(2) {
						width: 210rpx;
						height: 90rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: bold;
						font-size: 38rpx;
						color: #333333;
						margin-left: 20rpx;
						display: flex;
						justify-content: center;
						flex-wrap: wrap;
						align-items: center;
					}
	
					.HongBao_y_hb_src_yb_box>view:nth-child(3) {
						width: 160rpx;
						height: 90rpx;
						margin-left: 25rpx;
						display: flex;
						justify-content: center;
						flex-wrap: wrap;
						align-items: center;
					}
				}
	
				.HongBao_hx_hb_src {
					width: 440rpx;
					height: 546rpx;
					background: #FFFFFF;
					border-radius: 20rpx;
					float: left;
				}
	
				.HongBao_hx_hb_src>view:nth-child(1),
				.HongBao_hx_hb_src>view:nth-child(3) {
					width: 100%;
					height: auto;
					text-align: center;
					margin-top: 50rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					font-size: 32rpx;
					color: #333333;
				}
	
				.HongBao_hx_hb_src>view:nth-child(2) {
					width: 280rpx;
					height: 280rpx;
					margin: 53rpx auto 0;
				}
	
				.HongBao_hx_hb_src>view:nth-child(3) {
					font-weight: 500;
					font-size: 28rpx;
					color: #999999;
				}
	
	
			}
	
			.HongBao_x_gs {
				width: 670rpx;
				height: auto;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 22rpx;
				color: #FFFFFF;
				margin: 20rpx auto 0;
			}
		}
	}
</style>